package 草稿包;

import java.util.Scanner;
/**
 * TODO
 *
 * @Description
 * @Author Lx
 * @Date 2024/5/18 20:05
 **/
public class WinningStrategyGame {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        for (int t = 0; t < n; t++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            boolean res = bisheng(a, b);
            System.out.println(res);
        }
    }
    public static boolean bisheng(int a, int b) {
        return (a ^ b) != 0;
    }
}